package com.fourforfo.fourmall.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fourforfo.common.to.SkuStockTO;
import com.fourforfo.common.to.mq.OrderTO;
import com.fourforfo.common.utils.PageUtils;
import com.fourforfo.fourmall.ware.entity.PurchaseDetailEntity;
import com.fourforfo.fourmall.ware.entity.WareSkuEntity;
import com.fourforfo.fourmall.ware.vo.LockStockResult;
import com.fourforfo.fourmall.ware.vo.WareSkuLockTO;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author fourforfo
 * @email fourforfo@gmail.com
 * @date 2022-06-16 12:41:34
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 将成功采购的purchaseDetail信息进行入库
     * @param purchaseDetailEntities
     */
    void saveFinishPurchaseDetail(List<PurchaseDetailEntity> purchaseDetailEntities);

    /**
     * 根据skuIds查出所有的sku库存信息
     * @param skuIds
     */
    List<SkuStockTO> listBySkus(List<Long> skuIds);

    /**
     * 订单服务远程发送请求锁定库存结果
     * @param vo
     * @return
     */
    Boolean orderLockStock(WareSkuLockTO vo);


    /**
     * 根据订单信息解锁订单
     * @param orderTO
     */
    void unlockStock(OrderTO orderTO);
}

